package iu.test;

import org.openqa.selenium.*;
import org.testng.Assert;
import pages.HomePage;
import utils.LogTest;


/**
 * Created by Olga on 05.06.2014.
 */
public class CommonTestSteps extends OpenClose {
    HomePage page = new HomePage(driver);

    public void searchProduct(String productName) {
        page.clearSearchBox();
        page.searchGood(productName);
        page.waitAddToCompare();
    }

    public void addToComparison() {
        page.addToCompare();
        page.clearSearchBox();

    }

    public void comparisonWorks(String prod1, String prod2) {
        page.waitToCompare();
        page.gotoComparison();
        page.waitForText(prod1);
        Assert.assertTrue(page.checkComparison(prod1));
        Assert.assertTrue(page.checkComparison(prod2));
    }

    public void gotoHomepage() {
        page.gotoHomePage();
    }

    public void productNotFound(String product) {
        Assert.assertFalse(page.searchGood(product));
        LogTest.info(product + " not Found");
    }


}
